<?php
declare(strict_types=1);
namespace app\admin\controller;

use app\admin\service\LoginService;
use app\common\model\AdminLogModel;
use app\common\model\AdminModel;
use think\Response;
use think\response\View;

class Login
{
    //登录页面
    public function index(): View
    {
       return view('login/index');
    }

    public function login(): Response
    {
        $userName = trim(input('username',''));
        $password = trim(input('password',''));
        if(!$userName) return echoJson(errorJson('账号不能为空'));
        if(!$password) return echoJson(errorJson('密码不能为空'));
        return echoJson((new LoginService())->login($userName,$password));
    }

}